﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Satates.FarmerStates;

namespace Operators.FarmerOperators
{
    public class MoveCabbageLeft : iOperator
    {

        public override string ToString()
        {
            return "Moving Cabbage Left";
        }
        public int getOperatorNumber()
        {
            return 5;
        }

        public Common.Template execute(Common.Template t)
        {
            FarmerStates s2 =  (FarmerStates)t;
            s2.setLeftCabbage(1);
            s2.setRightCabbage(0);
            s2.setLeftFarmer(1);
            s2.setRightFarmer(0);
            return s2;
        }

        public bool available(Common.Template t)
        {
            FarmerStates s = (FarmerStates)t;
            if (s.getRightFarmer() == 1 && s.getRightCabbage() == 1)
            {
                if (!(s.getRightWolf() == 1 && s.getRightSheep() == 1))
                {
                    return true;
                }
            }
            return false;
        }
        public object Clone()
        {
            return this.MemberwiseClone();
        }
    }
}
